﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Csla;
using Ninject;

namespace CslaHispano.EncapsulatedInvoke.Domain.Entities
{
    [Serializable()]
    public partial class SystemEdit:BusinessBase<SystemEdit>
    {
        private IKernel _NInject; 

        #region Properties

        public static readonly PropertyInfo<string> SystemIdProperty = RegisterProperty<string>(c => c.SystemId);
        public string SystemId
        {
            get { return GetProperty(SystemIdProperty); }
            private set { SetProperty(SystemIdProperty, value); }
        }

        public static readonly PropertyInfo<string> TagProperty = RegisterProperty<string>(c => c.Tag);
        public string Tag
        {
            get { return GetProperty(TagProperty); }
            set { SetProperty(TagProperty, value); }
        }

        public static readonly PropertyInfo<string> CodeProperty = RegisterProperty<string>(c => c.Code);
        public string Code
        {
            get { return GetProperty(CodeProperty); }
            set { SetProperty(CodeProperty, value); }
        }

        public static readonly PropertyInfo<string> DescriptionProperty = RegisterProperty<string>(c => c.Description);
        public string Description
        {
            get { return GetProperty(DescriptionProperty); }
            set { SetProperty(DescriptionProperty, value); }
        }

        public static readonly PropertyInfo<string> PathProperty = RegisterProperty<string>(c => c.Path);
        public string Path
        {
            get { return GetProperty(PathProperty); }
            set { SetProperty(PathProperty, value); }
        }

        public static readonly PropertyInfo<Boolean> StatusProperty = RegisterProperty<Boolean>(c => c.Status);
        public Boolean Status
        {
            get { return GetProperty(StatusProperty); }
            set { SetProperty(StatusProperty, value); }
        }          


        public static readonly PropertyInfo<SystemModules> ModulesProperty = RegisterProperty<SystemModules>(c => c.Modules);
        public SystemModules Modules
        {
            get { return GetProperty(ModulesProperty); }
            set { SetProperty(ModulesProperty, value); }
        }

        #endregion

        #region Factory Methods

        public static SystemEdit NewSystemEdit()
        {            
            return DataPortal.Create<SystemEdit>();                                     
        }

        public static SystemEdit GetSystemEdit(string systemId)
        {
            return DataPortal.Fetch<SystemEdit>(new SingleCriteria<SystemEdit, string>(systemId));                                     
        }

        public static void DeleteSystemEdit(string systemId)
        {
            DataPortal.Delete<SystemEdit>(new SingleCriteria<SystemEdit, string>(systemId));
        }

        private SystemEdit()
        {
            _NInject = (StandardKernel)Csla.ApplicationContext.ClientContext["NInject"]; 
        }

        ~SystemEdit()
        {
            _NInject = null;
        }

        #endregion
    }
}
